CREATE TABLE [dbo].[UserMessages](
	[UserMessageID] [uniqueidentifier] NOT NULL,
	[CreationDate] [datetime] NOT NULL,
	[FromUserID] [uniqueidentifier] NOT NULL,
	[ToUserID] [uniqueidentifier] NOT NULL,
	[Subject] [nvarchar](255) NOT NULL,
	[Message] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_UserMessages] PRIMARY KEY CLUSTERED 
(
	[UserMessageID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]







GO

/****** Object:  ForeignKey [FK_UserMessages_Users]    Script Date: 04/08/2010 13:38:50 ******/
/****** Object:  ForeignKey [FK_UserMessages_Users]    Script Date: 04/08/2010 13:41:56 ******/
ALTER TABLE [dbo].[UserMessages]  WITH CHECK ADD  CONSTRAINT [FK_UserMessages_Users] FOREIGN KEY([FromUserID])
REFERENCES [dbo].[Users] ([UserID])
ON UPDATE CASCADE
ON DELETE CASCADE


GO
ALTER TABLE [dbo].[UserMessages] CHECK CONSTRAINT [FK_UserMessages_Users]




GO
ALTER TABLE [dbo].[UserMessages] CHECK CONSTRAINT [FK_UserMessages_Users]


GO

ALTER TABLE [dbo].[UserMessages] CHECK CONSTRAINT [FK_UserMessages_Users]
GO

ALTER TABLE [dbo].[UserMessages]  WITH CHECK ADD  CONSTRAINT [FK_UserMessages_Users1] FOREIGN KEY([ToUserID])
REFERENCES [dbo].[Users] ([UserID])
GO

ALTER TABLE [dbo].[UserMessages] CHECK CONSTRAINT [FK_UserMessages_Users1]
GO

